package collection.set;

import java.util.Set;
import java.util.TreeSet;

public class Demo06Comparator {
    public static void main(String[] args) {
        Person[] people = {
                new Person("jhh1", 80, 20),
                new Person("jhh2", 120, 20),
                new Person("jhh3", 130, 20),
                new Person("jhh4", 100, 20),
                new Person("jhh5", 140, 20),
                new Person("jhh6", 90, 20),
        };

        Set<Person> treeSet = new TreeSet(new MyComparator());

        for (int i = 0; i < people.length; i++) {
            treeSet.add(people[i]);
        }

        System.out.println(treeSet);
    }
}
